#include <bits/stdc++.h>
using namespace std;
const int MAX_SIZE = 731;
char grid[MAX_SIZE][MAX_SIZE];
void build(int n, int x, int y, int size) {
    if (n == 1) {
        grid[x][y] = 'X';
        return;
    }
    int sub_size = size / 3;
    build(n-1, x, y, sub_size);             
    build(n-1, x, y + 2*sub_size, sub_size); 
    build(n-1, x + sub_size, y + sub_size, sub_size); 
    build(n-1, x + 2*sub_size, y, sub_size);
    build(n-1, x + 2 * sub_size, y + 2*sub_size, sub_size);
}
int main() {
    int n;
    cin >> n;
    for (int i = 0; i < MAX_SIZE; i++) {
        for (int j = 0; j < MAX_SIZE; j++) {
            grid[i][j] = ' ';
        }
    }

    int size = 1;
    for (int i = 0; i < n-1; ++i) {
        size *= 3;
    }
    
    build(n, 0, 0, size);
    for (int i = 0; i < size; ++i) {
        for (int j = 0; j < size; ++j) {
            cout << grid[i][j];
        }
        cout << endl;
    }

    return 0;
}